package com.hqj.controller;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/pc")
public class ProviderController {

    @RequestMapping("/getStr")
    public String getStr(){
        return "hqj123";
    }

    @RequestMapping("/getStr2")
    @HystrixCommand(fallbackMethod = "getHystrixInfo")
    public String getStr2(){

        if(1==1){
            throw new RuntimeException("熔断异常！");
        }
        return "hqj123";
    }

    public String getHystrixInfo(){
        return "服务提供者发生熔断！";
    }
}
